
package pos.control;

import java.sql.Date;
import java.sql.PreparedStatement;
import java.sql.SQLException;
import java.sql.Statement;
import pos.Pos;
import pos.entity.Item;
import pos.storage.db.sql.SQL;

/**
 * This class is an control object class that deal with delete an item from
 * the database.
 * @author wei zhang
 */
public class DeleteItemUPCControl {
    /**
     * This method delete an item and return an boolean value that indicates if
     * the deletion is completed.
     * @param itemId
     * @return
     */
    public boolean deleteItem(String itemId){
      try{
            PreparedStatement stmt = Pos.adminConn.prepareStatement(SQL.DELETEITEM);
            stmt.setString(1,itemId);
            stmt.executeUpdate();
            return true;
        }
        catch(SQLException e){
            e.printStackTrace();
            return false;
        }
    }

}
